//就是来管理数据的
const defaultState = {
  num: 20
}
let reducer = (state = defaultState, action: { type: string, val: number }) => {
  let newState = JSON.parse(JSON.stringify(state))
  console.log("执行了reducer");
  console.log(action);
  switch (action.type) {
    case "add":
      newState.num += action.val
      break;
    default:
      break;
  }

  return newState
}
export default reducer